home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / mus / play / multiplsr.lha / okta8play.asm < prev    next >
Assembly Source File  |  1992-09-14  |  23KB  |  818 lines

  1. * MultiPlayer
  2. * Copyright (C) 1992 Bryan Ford
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. * I (the author of MultiPlayer) can be contacted on the Internet at
  19. * "bryan.ford@m.cc.utah.edu".  See "Player.doc" for other addresses.
  20. *
  21. * Note:  This playroutine was not originally written by me.  In general
  22. * these playroutines are public domain, so I am bringing the versions
  23. * modified for MultiPlayer under the General Public License.  In the
  24. * few cases of already-copyrighted playroutines, the above copyright
  25. * notice applies only to the parts of the file written by me.
  26. *
  27. * $Id: okta8play.asm,v 4.1 92/06/21 11:14:37 BAF Exp Locker: BAF $
  28. *
  29.  
  30.         include "exec/types.i"
  31.         include "exec/memory.i"
  32.         include "exec/libraries.i"
  33.         include "exec/execbase.i"
  34.         include "exec/funcdef.i"
  35.         include "exec/exec_lib.i"
  36.         include "intuition/intuition_lib.i"
  37.         include "player.i"
  38.         include "bry/macros.i"
  39.  
  40. BUFLEN  equ     632
  41. MINPER  equ     113
  42.  
  43.         code    text
  44.  
  45.         xref    modspec,modmem,modend,intsongpos,intrepeat,getfreqmodspeed
  46.         xref    unloadfile,_IntuitionBase,intflashnote
  47.  
  48.         xref    p8_Start,p8_Stop
  49.         xref    p8_SetPeriod,p8_SetVolume
  50.         xref    p8_PlaySample,p8_Release,p8_StopSample
  51.         xref    p8_AudioInt
  52.  
  53.         xdef    okta8start
  54.  
  55. okta8start:
  56.         plstartret 9$
  57.  
  58. 1$      lea     name(pc),a0
  59.         ml      a0,d0
  60.         rts
  61.  
  62. 2$      ml      4,a1
  63.         mw      #227,d0
  64.         btst    #AFB_68020,AttnFlags+1(a1)
  65.         bz      p8_Start
  66.         mw      #127,d0
  67.         bra     p8_Start
  68.  
  69.         cnop    0,4
  70.         dc.l    gmod_SetVolume+4
  71. 9$      gmodbra rs_init
  72.         gmodbra 2$                      ; StartMusic
  73.         gmodbra p8_Stop
  74.         gmodbra rs_free
  75.         gmodnop
  76.         gmodnop
  77.         gmodnop
  78.         gmodnop
  79.         gmodbra rs_int
  80.         gmodnop
  81.         gmodnop
  82.         gmodnop
  83.         gmodnop
  84.         gmodnop
  85.         gmodnop
  86.         gmodnop
  87.         gmodnop
  88.         gmodbra 1$                      ; GetMakerName
  89.         gmodbra \hook                   ; Hook
  90.         gmodnop
  91.         gmodbra \vol                    ; SetVolume
  92.  
  93. \hook
  94.         move.l  #GMODHF_REPEAT!GMODHF_SEQUENCE,d0
  95.         rts
  96.  
  97. \vol
  98.         move.w  d0,leftvol
  99.         move.w  d1,rightvol
  100.         rts
  101.  
  102.  STRUCTURE      sample,0
  103.         STRUCT  sm_name,20
  104.         ULONG   sm_length
  105.         UWORD   sm_rep24
  106.         UWORD   sm_rep26
  107.         UBYTE   sm_b
  108.         UBYTE   sm_vol
  109.         UWORD   sm_playmode
  110.         LABEL   sm_SIZEOF
  111.  
  112.  STRUCTURE      mysample,0
  113.         APTR    msm_ptr
  114.         UWORD   msm_len
  115.         UWORD   msm_replen
  116.         APTR    msm_relptr
  117.         UWORD   msm_rellen
  118. msm_SIZEOF      equ     sm_SIZEOF
  119.  
  120.  STRUCTURE      pbuff,0
  121.         APTR    pb_relptr               ; 6
  122.         UWORD   pb_rellen               ; 10
  123.         UWORD   pb_note                 ; 12
  124.         UWORD   pb_period               ; 14
  125.         UBYTE   pb_active
  126.         UBYTE   pb_pad
  127.         LABEL   pb_SIZEOF
  128.  
  129. **********************************
  130. * OKTALYZER V1.1 REPLAYER SOURCE *
  131. **********************************
  132.  
  133. ;by A.Sander with Defpac2
  134. ;(C) 1989 VERLAG MAYER
  135. ;- only for 4-Channels
  136.  
  137. * init ********************************
  138.  
  139. p:
  140.  
  141. rs_init         bsr     rs_free
  142.  
  143.                 push    d2-d3/d7/a2-a3/a5-a6
  144.                 ml      sp,d7
  145.  
  146.                 move.l  modmem,a5
  147.                 cmp.l   #'OKTA',(a5)+
  148.                 bne     rs_error2
  149.                 cmp.l   #'SONG',(a5)+
  150.                 bne     rs_error2
  151.                 move.l  a5,a0
  152.                 lea     rs_cmformat(pc),a1
  153.                 bsr     rs_search
  154.                 move.l  a5,a0
  155.                 lea     rs_extformat(pc),a1
  156.                 bsr     rs_search
  157.                 bsr     rs_getpatts
  158.                 bsr     rs_getsamples
  159.  
  160.                 lea     rs_pbuffs(pc),a0
  161.                 moveq   #pb_SIZEOF*8/4-1,d0
  162. rs_loop4        clr.l   (a0)+
  163.                 dbf     d0,rs_loop4
  164.  
  165.                 lea     rs_channelmodes(pc),a0
  166.                 lea     rs_pbuffs+pb_active(pc),a1
  167.                 moveq   #4-1,d0
  168.                 cq      d3
  169. 1$              move.w  (a0)+,d1
  170.                 st      (a1)
  171.                 move.b  d1,pb_SIZEOF(a1)
  172.                 lea     pb_SIZEOF*2(a1),a1
  173.                 moveq   #1,d2
  174.                 lsl.w   d1,d2
  175.                 add.w   d2,d3
  176.                 dbra    d0,1$
  177.                 move.w  d3,rs_channels
  178.                 lsl.w   #2,d3
  179.                 move.w  d3,rs_pattlinelen
  180.  
  181.                 clr.w   rs_pointer
  182.                 bsr     rs_gettrkpos
  183.                 sub.l   d3,rs_trkpos
  184.                 subq.w  #1,rs_patty
  185.  
  186.                 move.l  #$40404040,rs_vol
  187.                 clr.w   rs_filter
  188.                 move.w  rs_speed,rs_actspeed
  189.                 clr.w   rs_actcyc
  190.                 move.w  #-1,rs_nextpt
  191.  
  192.                 lea     rs_pattline(pc),a0
  193.                 moveq   #8-1,d0
  194. rs_loop5        clr.l   (a0)+
  195.                 dbf     d0,rs_loop5
  196.  
  197.                 cq      d0
  198.                 cq      d1
  199.                 mw      rs_len(pc),d1
  200.                 jsr     intsongpos
  201.  
  202.                 lea     modspec,a0
  203.                 jsr     unloadfile
  204.  
  205.                 moveq   #0,d0
  206. rs_initout      ml      d7,sp
  207.                 pop     d2-d3/d7/a2-a3/a5-a6
  208.                 rts
  209. rs_error2       lea     errmes(pc),a0
  210.                 ml      a0,d0
  211.                 b       rs_initout
  212. rs_nomem        lea     errnomem(pc),a0
  213.                 ml      a0,d0
  214.                 b       rs_initout
  215.  
  216. * format search ***********************
  217.  
  218. ;a0 fpt
  219. ;a1 format list
  220.  
  221. rs_search       move.l  a0,a2
  222.                 move.l  (a1)+,d0
  223.                 beq.s   rs_ex
  224. rs_loop         cmp.l   modend,a2
  225.                 bhs.s   rs_ex
  226.                 cmp.l   (a2)+,d0
  227.                 bne.s   rs_next
  228.                 move.l  (a1)+,d0
  229.                 cmp.l   (a2)+,d0
  230.                 ble.s   rs_nocorrect
  231.                 move.l  -4(a2),d0
  232. rs_nocorrect    move.l  (a1)+,a3
  233. rs_copy         subq.l  #1,d0
  234.                 bmi.s   rs_search
  235.                 move.b  (a2)+,(a3)+
  236.                 bra.s   rs_copy
  237. rs_next         add.l   (a2)+,a2
  238.                 bra.s   rs_loop
  239. rs_ex           rts
  240.  
  241. * pattern descriptor ******************
  242.  
  243. rs_getpatts     lea     rs_pattpts(pc),a2
  244.                 move.l  a5,a3
  245.                 move.l  #'PBOD',d3
  246. rs_loop2        cmp.l   modend,a3
  247.                 bhs.s   rs_ready
  248.                 movem.l (a3)+,d1-d2
  249.                 cmp.l   d3,d1
  250.                 beq.s   rs_got
  251.                 add.l   d2,a3
  252.                 bra.s   rs_loop2
  253. rs_got          ml      d2,d0
  254.                 bsr     alloc
  255.                 ml      d0,(a2)+
  256.  
  257.                 ml      d0,a1
  258.                 ml      a3,a0
  259.                 ml      d2,d0
  260.                 ml      4,a6
  261.                 jl      CopyMem
  262.  
  263.                 add.l   d2,a3
  264.                 bra.s   rs_loop2
  265. rs_ready        rts
  266.  
  267. * sample descriptor *******************
  268.  
  269. rs_getsamples   lea     rs_samples(pc),a2
  270.                 move.l  a5,a3
  271.                 move.l  #'SBOD',d3
  272. rs_loop2a       cmp.l   modend,a3
  273.                 bhs     rs_sready
  274.                 movem.l (a3)+,d1-d2
  275.                 cmp.l   d3,d1
  276.                 beq.s   rs_gots
  277.                 add.l   d2,a3
  278.                 bra.s   rs_loop2a
  279.  
  280. rs_gots         tst.l   20(a2)
  281.                 bne.s   rs_setsample
  282.                 clr.l   msm_ptr(a2)
  283.                 lea     sm_SIZEOF(a2),a2
  284.                 bra.s   rs_gots
  285.  
  286. rs_setsample
  287.         tst.w   26(a2)
  288.         bz      \norep
  289.  
  290.         tst.w   24(a2)
  291.         bz      \releaseonly
  292.  
  293.         ml      a3,a0
  294.         cq      d0
  295.         mw      24(a2),d0
  296.         add.w   26(a2),d0
  297.         add.l   d0,d0
  298.         cq      d1
  299.         mw      26(a2),d1
  300.         add.l   d1,d1
  301.         bsr     \repeat
  302.  
  303.         b       \release
  304.  
  305. \releaseonly
  306.         ml      a3,a0
  307.         cq      d0
  308.         mw      26(a2),d0
  309.         add.l   d0,d0
  310.         ml      d0,d1
  311.         bsr     \repeat
  312.  
  313. \release
  314.         ml      a3,a0
  315.         cq      d1
  316.         mw      msm_len(a2),d1
  317.         adda.l  d1,a0
  318.         ml      d2,d0
  319.         sub.l   d1,d0
  320.         lea     msm_relptr(a2),a2
  321.         bsr     \oneshot
  322.         lea     -msm_relptr(a2),a2
  323.         b       \done
  324. \norep
  325.         clr.w   msm_replen(a2)
  326.         clr.l   msm_relptr(a2)
  327.         clr.w   msm_rellen(a2)
  328.         ml      a3,a0
  329.         cq      d0
  330.         mw      d2,d0
  331.         bsr     \oneshot
  332.  
  333. \done
  334.         lea     sm_SIZEOF(a2),a2
  335.         add.l   d2,a3
  336.         bra     rs_loop2a
  337.  
  338. \oneshot
  339.         bsr     \getit
  340.  
  341.         cq      d1
  342. \oneshot_clr
  343.         mw      d1,(a1)+
  344.         dbra    d0,\oneshot_clr
  345.         rts
  346.  
  347. \repeat
  348.         cmp.w   #2,d1                   ; Forget these stupid little pseudo-repeats
  349.         bhi.b   \repeat_notone
  350.         clr.w   msm_replen(a2)
  351.         b       \oneshot
  352. \repeat_notone
  353.         mw      d1,msm_replen(a2)
  354.  
  355.         bsr     \getit
  356.  
  357.         ml      a1,a0
  358.         cq      d1
  359.         mw      msm_replen(a2),d1
  360.         sub.l   d1,a0
  361. \repeat_cpy
  362.         mw      (a0)+,(a1)+
  363.         dbra    d0,\repeat_cpy
  364.         rts
  365.  
  366. \getit
  367.         mw      d0,msm_len(a2)
  368.         bz      \getnothing
  369.         add.l   #BUFLEN,d0
  370.         bsr     alloc
  371.         move.l  d0,msm_ptr(a2)
  372.  
  373.         ml      d0,a1
  374.         cq      d0
  375.         mw      msm_len(a2),d0
  376.         ml      4,a6
  377.         jl      CopyMem
  378.  
  379.         ml      msm_ptr(a2),a1
  380.         cq      d1
  381.         mw      msm_len(a2),d1
  382.         add.l   d1,a1
  383.         mw      #BUFLEN/2-1,d0
  384.         rts
  385.  
  386. \getnothing
  387.         clr.l   msm_ptr(a2)
  388.         clr.w   msm_len(a2)
  389.         addq    #4,sp
  390.         rts
  391.  
  392. rs_sready       rts
  393.  
  394. alloc
  395.         push    d1/a0-a1
  396.         ml      #MEMF_PUBLIC,d1
  397.         lea     rs_remember(pc),a0
  398.         ml      _IntuitionBase,a6
  399.         jl      AllocRemember
  400.         tst.l   d0
  401.         bz      rs_nomem
  402.         pop     d1/a0-a1
  403.         rts
  404.  
  405. * exit ********************************
  406.  
  407. rs_free
  408.         push    a6
  409.         ml      _IntuitionBase,a6
  410.         lea     rs_remember(pc),a0
  411.         mq      #1,d0
  412.         jl      FreeRemember
  413.         pop     a6
  414.         rts
  415.  
  416. * interrupt ***************************
  417.  
  418. rs_int          movem.l d2-d7/a2-a6,-(sp)
  419.                 bsr.b   rs_rh
  420.                 movem.l (sp)+,d2-d7/a2-a6
  421.                 bra     p8_AudioInt
  422.  
  423. rs_rh           bsr     rs_p8
  424.                 addq.w  #1,rs_actcyc
  425.                 move.w  rs_actspeed,d0
  426.                 cmp.w   rs_actcyc,d0
  427.                 ble.s   rs_addcyc
  428.                 rts
  429.  
  430. rs_addcyc       clr.w   rs_actcyc
  431.                 cq      d0
  432.                 mw      rs_pattlinelen(pc),d0
  433.                 add.l   d0,rs_trkpos
  434.                 addq.w  #1,rs_patty
  435.                 bsr     rs_getppatt
  436.                 tst.w   rs_nextpt
  437.                 bpl.s   rs_pattend
  438.                 cmp.w   rs_patty,d0
  439.                 bgt.s   rs_nonew
  440. rs_pattend      clr.w   rs_patty
  441.                 tst.w   rs_nextpt
  442.                 bmi     rs_nonextpt
  443.                 move.w  rs_nextpt,rs_pointer
  444.                 bra.s   rs_newpos
  445. rs_nonextpt     addq.w  #1,rs_pointer
  446. rs_newpos       move.w  rs_pointer(pc),d0
  447.                 cmp.w   rs_len,d0
  448.                 bne.s   rs_nonewinit
  449.                 clr.w   rs_pointer
  450.                 move.w  rs_speed(pc),rs_actspeed
  451.                 jsr     intrepeat
  452. rs_nonewinit    mw      rs_pointer(pc),d0
  453.                 mw      rs_len(pc),d1
  454.                 jsr     intsongpos
  455.                 bsr     rs_gettrkpos
  456. rs_nonew        move.l  rs_trkpos(pc),a0
  457.                 lea     rs_pattline,a1
  458.                 move.l  (a0)+,(a1)+
  459.                 move.l  (a0)+,(a1)+
  460.                 move.l  (a0)+,(a1)+
  461.                 move.l  (a0)+,(a1)+
  462.                 move.l  (a0)+,(a1)+
  463.                 move.l  (a0)+,(a1)+
  464.                 move.l  (a0)+,(a1)+
  465.                 move.l  (a0)+,(a1)+
  466.                 move.w  #-1,rs_nextpt
  467.                 rts
  468.  
  469. rs_p8           tst.w   rs_actcyc
  470.                 bnz.s   rs_effects
  471.  
  472.                 bsr     rs_set
  473.                 bsr     rs_setperiods ;FIXME - put in rs_set
  474.  
  475. rs_effects      bsr     rs_effect
  476.                 lea     rs_vol,a0
  477.  
  478.                 lea     $dff0a9,a1      ; Questionable conduct when using play8,
  479.                 cq      d0              ; but it works fine...
  480.                 move.b  (a0)+,d0
  481.                 mulu.w  leftvol(pc),d0
  482.                 lsr.w   #8,d0
  483.                 move.b  d0,(a1)
  484.                 cq      d0
  485.                 move.b  (a0)+,d0
  486.                 mulu.w  rightvol(pc),d0
  487.                 lsr.w   #8,d0
  488.                 move.b  d0,$10(a1)
  489.                 cq      d0
  490.                 move.b  (a0)+,d0
  491.                 mulu.w  rightvol(pc),d0
  492.                 lsr.w   #8,d0
  493.                 move.b  d0,$20(a1)
  494.                 cq      d0
  495.                 move.b  (a0),d0
  496.                 mulu.w  leftvol(pc),d0
  497.                 lsr.w   #8,d0
  498.                 move.b  d0,$30(a1)
  499.  
  500.                 tst.b   rs_filter
  501.                 bz.b    rs_blink
  502.                 bclr    #1,$bfe001
  503.                 rts
  504. rs_blink        bset    #1,$bfe001
  505.                 rts
  506.  
  507. rs_set          lea     rs_pattline(pc),a2
  508.                 lea     rs_pbuffs(pc),a3
  509.                 lea     rs_samples(pc),a4
  510.                 lea     rs_periods(pc),a6
  511.  
  512.                 moveq   #8-1,d7
  513.  
  514. rs_ploop        tst.b   pb_active(a3)
  515.                 bz.b    1$
  516.                 bsr.s   rs_set8
  517.                 addq.w  #4,a2
  518. 1$              lea     pb_SIZEOF(a3),a3
  519.                 dbf     d7,rs_ploop
  520.                 rts
  521.  
  522. rs_set8         moveq   #0,d3
  523.                 move.b  (a2),d3
  524.                 bz      rs_noset
  525.                 subq.w  #1,d3
  526.  
  527.                 moveq   #0,d0
  528.                 move.b  1(a2),d0
  529.                 lsl.w   #5,d0
  530.                 lea     0(a4,d0.w),a1
  531.  
  532.                 tst.l   sm_length(a1)
  533.                 bz      rs_noset
  534.  
  535.                 push    d0-d2           ; BAF - Flash the note on the display
  536.                 mb      d7,d0
  537.                 mb      rs_flashnotes(pc,d3.w),d1
  538.                 mb      sm_vol(a1),d2
  539.                 bsr     intflashnote
  540.                 pop     d0-d2
  541.  
  542.                 move.w  d3,pb_note(a3)
  543.                 add.w   d3,d3
  544.                 move.w  0(a6,d3.w),pb_period(a3)
  545.  
  546.                 lea     rs_vol(pc),a0
  547.                 mw      d7,d0
  548.                 lsr.b   #1,d0
  549.                 move.b  sm_vol(a1),0(a0,d0.w)
  550.  
  551.                 ml      msm_relptr(a1),pb_relptr(a3)
  552.                 mw      msm_rellen(a3),pb_rellen(a3)
  553.  
  554.                 mw      d7,d0
  555.                 ml      msm_ptr(a1),a0
  556.                 mw      msm_len(a1),d1
  557.                 mw      msm_replen(a1),d2
  558.                 bra     p8_PlaySample
  559.  
  560. rs_noset        rts
  561.  
  562. rs_flashnotes   dc.b    0,7,14,21,28,35,42,49,56,64
  563.                 dc.b    71,78,85,92,99,106,113,120,128,135
  564.                 dc.b    142,149,156,163,170,177,184,192,199,206
  565.                 dc.b    213,220,227,234,241,248
  566.  
  567. rs_setperiods   lea     rs_pbuffs,a3
  568.                 mq      #8-1,d7
  569. 1$              mw      pb_period(a3),d1
  570.                 mw      d7,d0
  571.                 bsr     p8_SetPeriod
  572.                 lea     pb_SIZEOF(a3),a3
  573.                 dbra    d7,1$
  574.                 rts
  575.  
  576. rs_effect       lea     rs_pattline(pc),a2
  577.                 lea     rs_pbuffs(pc),a3
  578.                 lea     p(pc),a4
  579.                 lea     rs_periods(pc),a6
  580.                 moveq   #8-1,d7
  581. rs_eloop        tst.b   pb_active(a3)
  582.                 bz.b    1$
  583.                 bsr     rs_doeff
  584.                 addq.w  #4,a2
  585. 1$              lea     pb_SIZEOF(a3),a3
  586.                 dbf     d7,rs_eloop
  587.                 rts
  588.  
  589. rs_doeff        moveq   #0,d0
  590.                 move.b  2(a2),d0
  591.                 add.w   d0,d0
  592.                 moveq   #0,d1
  593.                 move.b  3(a2),d1
  594.  
  595.                 move.w  rs_effecttab(pc,d0.w),d0
  596.                 beq.s   rs_noeff
  597.                 bmi.s   rs_1eff
  598.  
  599.                 jmp     0(a4,d0.w)
  600.  
  601. rs_1eff         tst.w   rs_actcyc
  602.                 bne.s   rs_noeff
  603.                 neg.w   d0
  604.                 jmp     0(a4,d0.w)
  605.  
  606. rs_noeff        rts
  607.  
  608. rs_effecttab    dc.w    0,rs_portd-p,rs_portu-p,0,0,0
  609.                 dc.w    0,0,0,0,rs_arp-p,rs_arp2-p
  610.                 dc.w    0,rs_slided-p,0,p-rs_filt,0,p-rs_slideu
  611.                 dc.w    0,0,0,p-rs_slided,0,0
  612.                 dc.w    0,p-rs_posjmp,0,p-rs_release,p-rs_cspeed,0
  613.                 dc.w    rs_slideu-p,rs_volume-p,0,0,0,0
  614.  
  615. rs_portd        mw      pb_period(a3),d0
  616.                 sub.w   d1,d0
  617.                 cmp.w   #MINPER,d0
  618.                 bhs.b   1$
  619.                 mw      #MINPER,d0
  620. 1$              mw      d0,pb_period(a3)
  621.                 mw      d0,d1
  622.                 mw      d7,d0
  623.                 bra     p8_SetPeriod
  624.  
  625. rs_portu        add.w   pb_period(a3),d1
  626.                 move.w  d1,pb_period(a3)
  627.                 mw      d7,d0
  628.                 bra     p8_SetPeriod
  629.  
  630. rs_arp          move.w  pb_note(a3),d2
  631.                 move.w  rs_actcyc,d0
  632.                 move.b  rs_divtab(pc,d0.w),d0
  633.                 bnz.s   rs_val1
  634.                 and.w   #$f0,d1         ;runter
  635.                 lsr.w   #4,d1
  636.                 sub.w   d1,d2
  637.                 bra.s   rs_setarp
  638.  
  639. rs_val1         subq.b  #1,d0
  640.                 bnz.s   rs_val2
  641.                 bra.s   rs_setarp
  642.  
  643. rs_val2         and.w   #$0f,d1
  644.                 add.w   d1,d2
  645.                 bra.s   rs_setarp
  646.  
  647. rs_divtab       dc.b    0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2
  648.  
  649. rs_arp2         move.w  pb_note(a3),d2
  650.                 move.w  rs_actcyc,d0
  651.                 and.w   #3,d0
  652.                 bnz.s   rs_val3
  653.                 bra.s   rs_setarp
  654.  
  655. rs_val3         subq.b  #1,d0
  656.                 bnz.s   rs_val4
  657.                 and.w   #$f,d1
  658.                 add.w   d1,d2
  659.                 bra.s   rs_setarp
  660.  
  661. rs_val4         subq.b  #1,d0
  662.                 bz.s    rs_setarp
  663.                 and.w   #$f0,d1
  664.                 lsr.w   #4,d1
  665.                 sub.w   d1,d2
  666.  
  667. rs_setarp       tst.w   d2
  668.                 bpl.s   rs_arpok1
  669.                 moveq   #0,d2
  670. rs_arpok1       cmp.w   #35,d2
  671.                 ble.s   rs_arpok2
  672.                 moveq   #35,d2
  673. rs_arpok2       add.w   d2,d2
  674.                 move.w  0(a6,d2.w),d1
  675.                 move.w  d1,pb_period(a3)
  676.                 mw      d7,d0
  677.                 bra     p8_SetPeriod
  678.  
  679. rs_slided       move.w  pb_note(a3),d2
  680.                 sub.w   d1,d2
  681.                 move.w  d2,pb_note(a3)
  682.                 bra.s   rs_setarp
  683.  
  684. rs_slideu       move.w  pb_note(a3),d2
  685.                 add.w   d1,d2
  686.                 move.w  d2,pb_note(a3)
  687.                 bra.s   rs_setarp
  688.  
  689. rs_cspeed       and.w   #$f,d1
  690.                 beq.s   rs_nochange
  691.                 move.w  d1,rs_actspeed
  692. rs_nochange     rts
  693.  
  694. rs_filt         tst.b   d1
  695.                 sne     rs_filter
  696.                 rts
  697.  
  698. rs_volume       lea     rs_vol,a0
  699.                 mw      d7,d0
  700.                 lsr.w   #1,d0
  701.                 add.w   d0,a0
  702.                 cmp.w   #$40,d1
  703.                 bgt.s   rs_4567
  704.                 move.b  d1,(a0)
  705. rs_vex          rts
  706.  
  707. rs_4567         sub.b   #$40,d1
  708.                 cmp.b   #$10,d1
  709.                 blt.s   rs_4
  710.                 sub.b   #$10,d1
  711.                 cmp.b   #$10,d1
  712.                 blt.s   rs_5
  713.                 sub.b   #$10,d1
  714.                 cmp.b   #$10,d1
  715.                 blt.s   rs_6
  716.                 sub.b   #$10,d1
  717.                 cmp.b   #$10,d1
  718.                 blt.s   rs_7
  719.                 bra.s   rs_vex
  720.  
  721. rs_6            tst.w   rs_actcyc
  722.                 bne.s   rs_vex
  723.  
  724. rs_4            sub.b   d1,(a0)
  725.                 bcc.s   rs_vex
  726.                 clr.b   (a0)
  727.                 bra.s   rs_vex
  728.  
  729. rs_7            tst.w   rs_actcyc
  730.                 bne.s   rs_vex
  731.  
  732. rs_5            add.b   d1,(a0)
  733.                 cmp.b   #$40,(a0)
  734.                 ble.s   rs_vex
  735.                 move.b  #$40,(a0)
  736.                 bra.s   rs_vex
  737.  
  738. rs_release      mw      pb_rellen(a3),d1
  739.                 bz      rs_rex
  740.                 ml      pb_relptr(a3),a0
  741.                 cq      d2
  742.                 mw      d7,d0
  743.                 bra     p8_PlaySample
  744. rs_rex          rts
  745.  
  746. rs_posjmp       move.w  d1,d0
  747.                 and.w   #$f,d0
  748.                 lsr.w   #4,d1
  749.                 mulu    #10,d1
  750.                 add.w   d1,d0
  751.                 cmp.w   rs_len,d0
  752.                 bge.s   rs_nojmp
  753.                 move.w  d0,rs_nextpt
  754.                 jsr     intrepeat
  755. rs_nojmp        rts
  756.  
  757. rs_gettrkpos    lea     rs_patterns(pc),a0
  758.                 add.w   rs_pointer(pc),a0
  759.                 moveq   #0,d0
  760.                 move.b  (a0),d0
  761.                 bsr.s   rs_getpattern
  762.                 move.l  a0,rs_trkpos
  763.                 clr.w   rs_patty
  764.                 rts
  765.  
  766. rs_getppatt     lea     rs_patterns(pc),a0
  767.                 add.w   rs_pointer(pc),a0
  768.                 moveq   #0,d0
  769.                 move.b  (a0),d0
  770. rs_getpattern   lea     rs_pattpts,a0
  771.                 add.w   d0,d0
  772.                 add.w   d0,d0
  773.                 move.l  0(a0,d0.w),a0
  774.                 move.w  (a0)+,d0
  775.                 rts
  776.  
  777.                 cnop    0,4
  778.  
  779. rs_remember     dc.l    0
  780. rs_cmformat     dc.l    'CMOD',8,rs_channelmodes
  781. rs_extformat    dc.l    'SAMP',36*32,rs_samples
  782.                 dc.l    'SPEE',2,rs_speed
  783.                 dc.l    'PLEN',2,rs_len
  784.                 dc.l    'PATT',128,rs_patterns,0
  785. rs_channelmodes ds.w    4
  786. rs_channels     ds.w    1
  787. rs_samples      ds.b    36*32
  788. rs_speed        dc.w    6
  789. rs_len          dc.w    1
  790. rs_patterns     ds.b    128
  791. rs_pattpts      ds.l    64
  792. rs_patty        ds.w    1
  793. rs_trkpos       ds.l    1
  794. rs_pbuffs       ds.b    pb_SIZEOF*8
  795. rs_pattline     ds.l    8
  796. rs_pattlinelen  ds.w    1
  797. rs_actspeed     ds.w    1
  798. rs_actcyc       ds.w    1
  799. rs_nextpt       ds.w    1
  800. rs_pointer      ds.w    1
  801. rs_vol          ds.b    4
  802. rs_filter       ds.w    1
  803. rs_oldaud       ds.l    1
  804. rs_periods      dc.w    $358,$328,$2FA,$2D0,$2A6,$280,$25C,$23A,$21A
  805.                 dc.w    $1FC,$1E0,$1C5,$1AC,$194,$17D,$168,$153,$140
  806.                 dc.w    $12E,$11D,$10D,$FE,$F0,$E2,$D6,$CA,$BE
  807.                 dc.w    $B4,$AA,$A0,$97,$8F,$87,$7F,$78,$71
  808.  
  809. leftvol         dc.w    $100
  810. rightvol        dc.w    $100
  811.  
  812. name            dc.b    "Oktalyzer (8 channel)",0
  813.  
  814. errmes          dc.b    "Unknown Oktalyzer module variation",0
  815. errnomem        dc.b    "Not enough memory",0
  816.  
  817.         end
  818.